<template>
	<view>
		<t-btn color="info" @click="submit">提交{{indexNum}}</t-btn>
		<t-btn color="info" @click="submit">提交{{play_state}}</t-btn>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations,
		mapActions
	} from 'vuex' //引入mapState
	export default {
		mounted() {
			//获取store全局状态的值
			console.log(this.$store.state.user.userInfor.userId);
		},
		computed: {
			// ...mapState("user", ["userInfor"]) //添加了namespaced

			...mapState({
				userInfor: (state) => state.user.userInfor, //这里引入的是store->modules"user"->中的state数据,
				indexNum: (state) => state.indexNum, //这里引入的index.js中默认的state
				play_state: (state) => state.player.play_state,
			})

		},
		methods: {
			submit() {
				//	开启命名空间后使用方法	调用user模块下mutations中的 updateuserid()方法
				this.$store.commit("user/updateuserid")
			}
		},
	}
</script>

<style>

</style>
